import {
  legacy_createStore, // create_store / createStore
  combineReducers,
  applyMiddleware,
  CombinedState,
} from 'redux';
import head, { HeadState } from './reducers/head';
import homepage, { HomepageState } from './reducers/homepage';
import user, { UserState } from './reducers/user';
import thunk from 'redux-thunk';

const reducers = {
  head,
  user,
  homepage,
};

export type StoreState = CombinedState<{
  head: HeadState;
  user: UserState;
  homepage: HomepageState;
}>;

const rootReducer = combineReducers(reducers);

export default legacy_createStore(rootReducer, applyMiddleware(thunk));
